home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / travel_log.gl.p < prev    next >
Text File  |  2003-01-09  |  15KB  |  410 lines

  1. {
  2.  
  3.   Hidden = TRUE;
  4.  
  5.  
  6.   ChildID = {
  7.     GuiAnimation("background") {
  8.       AnimationID = "image/travel_log.pcx";
  9.       X = 0;
  10.       Y = 0;
  11.       },  
  12.         GuiTextInput("screen_name") {
  13.       X = 30;
  14.       Y = 40;
  15.           Width = 70;
  16.           Height = 20;
  17.           FontID = "font/verdana_9.tf";
  18.       InputDisabled = TRUE;      
  19.           InputText = Mangle(340/*"Travel Log"*/);
  20.         },
  21.         GuiButton("save_travel_log_button") {
  22.       X = 596;
  23.       Y = 40;
  24.       StyleID = "gui/bs/save_button.gbs";
  25.       AutoSize = WIDTH;
  26.       AutoSize = HEIGHT;
  27.       ScriptID = Script {
  28.         @activate { 
  29.           ResPropSetInt(GuiSiblingByName("save_layer"), "Hidden", FALSE);
  30.           ResPropSetInt(GuiSiblingByName("message_layer"), "Hidden", TRUE);
  31.         }
  32.       };    /* END OF SAVE BUTTON SCRIPT */
  33.     },    
  34.     GuiLayer("travel_log_layer") {
  35.       X = 25;
  36.       Y = 60;
  37.       ChildID = {
  38.                 GuiListbox("travel_log") {
  39.               X = 0;
  40.               Y = 0;
  41.           // prevent the listbox from allocating a StrList
  42.           // that will never be used by pointing it at one
  43.           // of the players travellogs.
  44.           StrListID = "Player1TravelLog";
  45.               Width = 595;
  46.               Height = 400;
  47.               FontID = "font/arial_black_14.tf";
  48.  
  49.               ScriptID = Script {
  50.             @animate { 
  51.               resid Player;                                 
  52.               Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
  53.               ResPropSetResID(SELF,"StrListID",ResPropGetResID(Player, "travel_log"));              
  54.             }
  55.             @show {
  56.               resid sb_id;
  57.               sb_id = GuiChildByName(SELF,"sbV");
  58.               ResPropSetInt(sb_id, "Value", ResPropGetInt(sb_id, "MaxValue"));
  59.             }
  60.           };
  61.               ChildID = {
  62.                 GuiScrollBar ("sbH") {
  63.                   Kind = HORIZONTAL;
  64.                   ChildID = {
  65.                     GuiButton("thumb") {
  66.                       StyleID = "gui/laptop/scrollbar/sb_thumb.gbs";
  67.                     },
  68.                     GuiButton("dec") {
  69.                       StyleID = "gui/laptop/scrollbar/sb_larrow.gbs";
  70.                     },
  71.                     GuiButton("inc") {
  72.                       StyleID = "gui/laptop/scrollbar/sb_rarrow.gbs";
  73.                     }
  74.                   };
  75.             },
  76.             GuiScrollBar ("sbV") {
  77.                   Kind = VERTICAL;
  78.                   ChildID = {
  79.                     GuiButton("thumb") {
  80.                       StyleID = "gui/laptop/scrollbar/sb_thumb.gbs";
  81.                     },
  82.                     GuiButton("dec") {
  83.                       StyleID = "gui/laptop/scrollbar/sb_uarrow.gbs";
  84.                     },
  85.                     GuiButton("inc") {
  86.                       StyleID = "gui/laptop/scrollbar/sb_darrow.gbs";
  87.                     }
  88.                   };
  89.                 }
  90.               };
  91.           }
  92.         };    /* END OF TRAVEL_LOG_LAYER CHILDID */
  93.     },      /* END OF TRAVEL_LOG */
  94.     
  95.     GuiLayer("save_layer") {
  96.       X = 180;
  97.       Y = 140;
  98.       Hidden = TRUE;
  99.           FontID = "font/verdana_black_bold_12.tf";
  100.     
  101.       ChildID = {
  102.         GuiAnimation("save_background") {
  103.           AnimationID = "gui/laptop/window/laptop_window.pcx";      
  104.           X = -10;
  105.           Y = -20;
  106.           Height = 288;
  107.           Width  = 285;  
  108.         },
  109.         GuiTextInput("instructions_text") {
  110.           X = 5;
  111.           Y = 0;
  112.           Width = 250;
  113.           Height = 100;
  114.           WordWrap = TRUE;
  115.           InputDisabled = TRUE;
  116.           FontID = "font/verdana_black_bold_12.tf";
  117.           InputText = Mangle(341/*"Type a name for your Travel Log and click 'Save'. File names must have less than 27 characters."*/);  
  118.         },
  119.         GuiListbox("save_travel_log_list_box") {
  120.           X      = 0;
  121.           Y      = 60;
  122.           Height = 120;
  123.           Width  = 269;
  124.           ListHilightedColor = #7FAFFF;
  125.           
  126.           ScriptID = Script {
  127.             @show {
  128.               GuiListboxClear(SELF);
  129.               GuiListboxLoadDirFiltered(SELF, CVarGetStr("SavedTravelLogDir"), "txt");
  130.             }
  131.             @activate {
  132.               str selected_filename;
  133.               selected_filename = GuiListboxGetSelected(SELF);
  134.               ResPropSetStr(GuiSiblingByName("save_filename_box"),"InputText", selected_filename);             
  135.             }
  136.           };
  137.           StrListID = StrList {
  138.             Size = 10240;
  139.             List = {
  140.              ""
  141.             };
  142.           };
  143.     
  144.           ChildID = {
  145.             GuiScrollBar ("sb") {
  146.               Kind = VERTICAL;
  147.               ChildID = {
  148.                 GuiButton("thumb") {
  149.                   StyleID = "gui/laptop/scrollbar/sb_thumb.gbs";
  150.                 },
  151.                 GuiButton("dec") {
  152.                   StyleID = "gui/laptop/scrollbar/sb_uarrow.gbs";
  153.                 },
  154.                 GuiButton("inc") {
  155.                   StyleID = "gui/laptop/scrollbar/sb_darrow.gbs";
  156.                 }
  157.               };
  158.             }
  159.          };
  160.        },  /* END OF load_game_list_box */
  161.         
  162.        GuiButton("save_button") {
  163.           X = 20;
  164.           Y = 220;
  165.           TextID = Mangle(250/*"Save"*/);
  166.           Width = 100;
  167.           AutoSize = HEIGHT;
  168.           StyleID = "gui/bs/laptop_button.gbs";
  169.           ScriptID = Script {
  170.             @update { 
  171.               str   filename;
  172.               str   filename_ext;
  173.               str   full_path;
  174.               resid Game;         
  175.               resid Player;  
  176.               resid message_layer_id; 
  177.               
  178.               Game = ResByName("Game");
  179.                   Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
  180.                   message_layer_id = GuiUncleByName("message_layer/message_text");
  181.                   
  182.               /* get the filename */
  183.               filename = ResPropGetStr(GuiSiblingByName("save_filename_box"),"InputText");
  184.                               
  185.               filename_ext = filename;
  186.               
  187.               /* form the full path */
  188.               if (StrIn(filename_ext, ".txt")) {
  189.                 full_path = StrFormatStr("%s%s", CVarGetStr("SavedTravelLogDir"),filename);
  190.               } else {
  191.                 filename_ext = StrFormatStr("%s.txt", filename_ext);
  192.                 full_path = StrFormatStr("%s%s.txt", CVarGetStr("SavedTravelLogDir"),filename);
  193.               }                      
  194.                  
  195.               /* save the game */
  196.               StrListToFile(ResPropGetResID(Player, "travel_log"), full_path);
  197.             }
  198.             @activate { 
  199.               resid Game;         
  200.               resid Player;  
  201.               resid message_layer_id; 
  202.               str   filename;
  203.               str   filename_ext;
  204.               str   full_path;
  205.               
  206.               Game = ResByName("Game");
  207.                   Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
  208.                   message_layer_id = GuiUncleByName("message_layer/message_text");
  209.              
  210.               /* get the filename */
  211.               filename = ResPropGetStr(GuiSiblingByName("save_filename_box"),"InputText");
  212.               
  213.               /* stop right now if there is nothing */
  214.               if (StrExact("",filename)) {
  215.                 ResPropSetInt(GuiUncleByName("message_layer"), "Hidden", FALSE);
  216.                 ResPropSetStr(message_layer_id,"InputText",MangleSIDToStr(251/*"You must type a file name."*/));              
  217.                 stop;
  218.               }
  219.               
  220.               /* check that the length of the filename is not too long */
  221.               if (StrLen(filename) >= 27) {
  222.                 ResPropSetInt(GuiUncleByName("message_layer"), "Hidden", FALSE);
  223.                 ResPropSetStr(message_layer_id,"InputText",MangleSIDToStr(252/*"The file name you have chosen is too long."*/));
  224.                 stop;
  225.               }
  226.               
  227.               /* check if the filename is empty */
  228.               if (StrExact("",filename)) {
  229.                 ResPropSetInt(GuiUncleByName("message_layer"), "Hidden", FALSE);
  230.                 ResPropSetStr(message_layer_id,"InputText",MangleSIDToStr(253/*"You must type a file name."*/));                
  231.               } else {
  232.                 ResPropSetStr(Game,"game_save_log_name", filename);
  233.               }
  234.               
  235.               filename_ext = filename;
  236.               
  237.               /* form the full path */
  238.               if (StrIn(filename_ext, ".txt")) {
  239.                 full_path = StrFormatStr("%s%s", CVarGetStr("SavedTravelLogDir"),filename);
  240.               } else {
  241.                 filename_ext = StrFormatStr("%s.txt", filename_ext);
  242.                 full_path = StrFormatStr("%s%s.txt", CVarGetStr("SavedTravelLogDir"),filename);
  243.               }
  244.                                       
  245.               /* check if the filename exist */
  246.               if (FileExist(full_path)) {                
  247.                 ResPropSetInt(GuiUncleByName("file_check_layer"), "Hidden", FALSE);
  248.                 ResPropSetStr(GuiUncleByName("file_check_layer/message_text"), "InputText", StrFormatStr(MangleSIDToStr(254/*"This folder already contains a file named '%s'. Would you like to replace the existing file?"*/), filename_ext));
  249.                 stop;
  250.               } else {                
  251.                 ResPropSetInt(GuiUncleByName("file_check_layer"), "Hidden", TRUE);
  252.               }
  253.               
  254.               /* save the game */
  255.               if (StrListToFile(ResPropGetResID(Player, "travel_log"), full_path) ) {
  256.                 ResPropSetInt(GuiUncleByName("message_layer"), "Hidden", FALSE);
  257.                 ResPropSetStr(message_layer_id,"InputText",StrFormatStr(MangleSIDToStr(255/*"Your travel log has been saved to '%s'."*/), filename_ext));
  258.                 ResPropSetInt(GuiUncleByName("message_layer/ok_save_button"),"Hidden", FALSE);
  259.               } else {
  260.                 ResPropSetInt(GuiUncleByName("message_layer"), "Hidden", FALSE);
  261.                 ResPropSetStr(message_layer_id,"InputText",MangleSIDToStr(256/*"Could not save travel log. Check save travel log path in options menu."*/));
  262.               }                  
  263.             }
  264.           };    /* END OF SAVE BUTTON SCRIPT */
  265.        }, 
  266.        GuiButton("cancel_button") {
  267.           X = 153;
  268.           Y = 220;
  269.           TextID = Mangle(257/*"Cancel"*/);
  270.           StyleID = "gui/bs/laptop_button.gbs";
  271.           Width = 100;
  272.           AutoSize = HEIGHT;
  273.           ScriptID = Script {
  274.             @activate { 
  275.               ResPropSetInt(ResByName("travel_log.gl/save_layer"),"Hidden", TRUE); 
  276.             }
  277.           };    /* END OF SAVE BUTTON SCRIPT */
  278.         }, 
  279.         GuiTextInput("save_filename_box") {
  280.           AnimationID = "gui/square/window/window_text_entry.pcx";
  281.           X = 5;
  282.           Y = 190;
  283.           Width = 250;
  284.           Height = 22;
  285.           FontID = "font/verdana_9_black.tf";
  286.           InsertCursorID = "gui/dash/tab/insert_cursor.pcx";
  287.           OverwriteCursorID = "gui/dash/tab/overwrite_cursor.pcx";
  288.           InputText = "";
  289.         }   /* END OF save_filename */
  290.       };    /* END OF SAVE LAYER CHILDID */
  291.     },    
  292.     
  293.     GuiLayer("file_check_layer") {
  294.       X = 160;
  295.       Y = 180;
  296.       Hidden = TRUE;
  297.           FontID = "font/verdana_black_bold_12.tf";
  298.       ChildID = {
  299.         GuiAnimation("save_background") {
  300.           AnimationID = "gui/laptop/window/laptop_window.pcx";      
  301.           X = 0;
  302.           Y = 0;
  303.           Height = 120;
  304.           Width  = 350;  
  305.         },
  306.        GuiButton("yes_button") {
  307.           X = 55;
  308.           Y = 88;
  309.           TextID = Mangle(258/*"YES"*/);
  310.           Width = 100;
  311.           StyleID = "gui/bs/laptop_button.gbs";
  312.           AutoSize = HEIGHT;
  313.           ScriptID = Script {
  314.             @activate { 
  315.               ResPropSetInt(ResByName("travel_log.gl/file_check_layer"),"Hidden", TRUE);
  316.               ResParseEvent(ResByName("travel_log.gl/save_layer/save_button"), "@update");
  317.               ResPropSetInt(ResByName("travel_log.gl/save_layer"),"Hidden", TRUE);  
  318.             }
  319.           };    /* END OF SAVE BUTTON SCRIPT */
  320.         },  
  321.         
  322.        GuiButton("no_button") {
  323.           X = 190;
  324.           Y = 88;
  325.           TextID = Mangle(259/*"NO"*/);
  326.           Width = 100;
  327.           StyleID = "gui/bs/laptop_button.gbs";
  328.           AutoSize = HEIGHT;
  329.           ScriptID = Script {
  330.             @activate { 
  331.               ResPropSetInt(ResByName("travel_log.gl/file_check_layer"),"Hidden", TRUE); 
  332.             }
  333.           };    /* END OF SAVE BUTTON SCRIPT */
  334.         },  
  335.         GuiTextInput("message_text") {
  336.           X = 10;
  337.           Y = 17;
  338.           Width = 300;
  339.           Height = 70;
  340.           WordWrap = TRUE;
  341.           InputDisabled = TRUE;
  342.         }         
  343.           
  344.       };  /* END OF message_layer CHILDID */           
  345.     },  
  346.     GuiLayer("message_layer") {
  347.       X = 160;
  348.       Y = 180;
  349.       Hidden = TRUE;
  350.           FontID = "font/verdana_black_bold_12.tf";
  351.       ScriptID = Script {
  352.         @show {
  353.           ResPropSetInt(ResByName("travel_log.gl/save_layer"),"Hidden", TRUE);  
  354.           ResPropSetInt(SELF,"Hidden", FALSE);        
  355.         }
  356.       };
  357.       ChildID = {
  358.         GuiAnimation("save_background") {
  359.           AnimationID = "gui/laptop/window/laptop_window.pcx";      
  360.           X = 0;
  361.           Y = 0;
  362.           Height = 120;
  363.           Width  = 350;  
  364.         },
  365.        GuiButton("ok_error_button") {
  366.           X = 120;
  367.           Y = 82;
  368.           TextID = Mangle(260/*"OK"*/);
  369.           Width = 100;
  370.           StyleID = "gui/bs/laptop_button.gbs";
  371.           AutoSize = HEIGHT;
  372.           ScriptID = Script {
  373.             @activate { 
  374.               ResPropSetInt(ResByName("travel_log.gl/message_layer"),"Hidden", TRUE); 
  375.               ResPropSetInt(ResByName("travel_log.gl/save_layer"),"Hidden", FALSE);  
  376.             }
  377.           };    /* END OF SAVE BUTTON SCRIPT */
  378.         },  
  379.         
  380.        GuiButton("ok_save_button") {
  381.           X = 120;
  382.           Y = 82;
  383.           TextID = Mangle(261/*"OK"*/);
  384.           Width = 100;
  385.           Hidden = TRUE;
  386.           StyleID = "gui/bs/laptop_button.gbs";
  387.           AutoSize = HEIGHT;
  388.           ScriptID = Script {
  389.             @activate { 
  390.               ResPropSetInt(GuiSiblingByName("ok_error_button"),"Hidden",FALSE);
  391.               ResPropSetInt(ResByName("travel_log.gl/message_layer"),"Hidden", TRUE); 
  392.               ResPropSetInt(ResByName("travel_log.gl/save_layer"),"Hidden", TRUE);  
  393.               ResPropSetInt(SELF,"Hidden", TRUE);  
  394.             }
  395.           };    /* END OF SAVE BUTTON SCRIPT */
  396.         },  
  397.         GuiTextInput("message_text") {
  398.           X = 10;
  399.           Y = 17;
  400.           Width = 300;
  401.           Height = 50;
  402.           WordWrap = TRUE;
  403.           InputDisabled = TRUE;
  404.         }         
  405.           
  406.       };  /* END OF message_layer CHILDID */           
  407.     }
  408.   };        /* END OF MAIN CHILID */
  409. }
  410.